home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / findline.zip / FINDLINE.DOC < prev    next >
Text File  |  1992-12-13  |  4KB  |  110 lines

  1. FINDLINE   Scan file for text string; set errorlevel if found.
  2.            Copyright (c) 1992 Creativity in Action.  All rights reserved.
  3.  
  4. SUMMARY
  5. =======
  6. FINDLINE scans a text file for a string of text.  Unlike the DOS FIND command,
  7. if the string is found in a line it sets an errorlevel flag.  This flag can be
  8. checked in a batch file.
  9.  
  10. SYNTAX
  11. ======
  12.     FINDLINE [/Help] [options] "search string" [d:][path]filename[.ext]
  13.  
  14. Where:
  15.     "search string"           is the text string (in quotes) that you're
  16.                               seeking, and
  17.     [d:][path]filename[.ext]  specifies the file to be scanned, including
  18.                               optional drive, path, and extension parameters.
  19.  
  20. Several switches are available:
  21.     
  22.     /H  Help.         Displays basic help information.
  23.     /A  All lines.    Scan the entire file and count the number of lines with
  24.                       matching strings.  Unless this switch is set the program
  25.                       will stop as soon as the first match is found.
  26.     /I  Ignore case.  Look for matches ignoring upper and lower case.
  27.     /L  Line show.    Displays the line that matches the search string.  This
  28.                       switch overrides the quiet mode switch.
  29.     /N  Number show.  Displays the line number associated with the matched
  30.                       line.  This switch works only if the /L switch is set.
  31.     /Q  Quiet mode.   Do not display messages.  Useful in a batch file.
  32.  
  33.  
  34. RETURN VALUES
  35. =============
  36. FINDLINE returns the following errorlevel codes
  37.  
  38.     errorlevel    meaning
  39.     ----------    -------
  40.     0             string not found
  41.     1             string found in at least one line
  42.     2-250         string found 2-250 times (only valid if /a switch was set)
  43.     251           error opening input file
  44.     253-254       error reading input file
  45.     255           help was requested; string not sought
  46.  
  47.  
  48. EXAMPLE
  49. =======
  50. You wish to scan a Windows .INI file to see if a string has already been
  51. loaded.
  52.  
  53. For example, assume you want to automatically install a section called
  54. [speaker.drv] to the SYSTEM.INI file, but only if it doesn't already exist.
  55. You create a separate file called SPEAKER.INI containing the following lines:
  56.  
  57.    [speaker.drv]
  58.    CPU Speed=71
  59.    Volume=500
  60.    Version=774
  61.    Enhanced=0
  62.    Max seconds=3
  63.    Leave interrupts enabled=0
  64.  
  65. In your auto-install batch file, include the following lines:
  66.  
  67.    REM for this example, let's first get into our c:\windows directory
  68.    c:
  69.    cd \windows
  70.  
  71.    REM FINDLINE will set errorlevel to 1 or greater if [speaker.drv] was found
  72.    REM /i to ignore case, /q since we don't want to watch FINDLINE work
  73.    FINDLINE "[speaker.drv]" system.ini /i /q
  74.    IF ERRORLEVEL 1 GOTO found
  75.       REM not found, so concatenate the speaker.ini file to the system.ini
  76.       echo Updating SYSTEM.INI ....
  77.       copy system.ini+speaker.ini > nul
  78.       goto done
  79.    :found
  80.    echo SYSTEM.INI already contains reference to [speaker.drv]
  81.    :done
  82.    echo Done ....
  83.  
  84.  
  85. SHAREWARE
  86. =========
  87. This program was written as shareware; your comments are welcome.  However, we
  88. reserve the copyright for the program.  If you find FINDLINE useful, send a
  89. few bucks to
  90.  
  91.      Creativity in Action, P. O. Box 6026, Fullerton, CA   92634-6026.
  92.  
  93. You're welcome--nay, encouraged--to distribute the program as long as you
  94. don't charge anything for it and don't change it in any way.  Be sure to
  95. include the documentation file when you distribute it.  You corporate guys--
  96. send a few extra bucks if you're going to use it all over the place.
  97.  
  98. Thanks for your support ....
  99.  
  100. HISTORY
  101. =======
  102. Version 0.90   Initial (beta) version
  103. Version 1.00   First release; added support of backslashes and hyphens for
  104.                switches; truncate switches to first two characters (virgule
  105.                plus letter); added several switches; reversed filename/
  106.                searchstring order for greater consistency with DR DOS and MS
  107.                DOS FIND command; changed some switch names, added others,
  108.                again for FIND consistency; added errorlevel codes for file
  109.                access errors.
  110.